c# winform ftp 文件下载 vs2017using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace ftpdown
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string uri = "ftp://127.0.0.1/";
string username = "administrator";
string password = "123";
var list = C_ftp.FtplistFile(uri, username, password);
string path = @"D:\Example";
foreach (var item in list)
{
C_ftp.Ftpdownloadfile(Path.Combine(uri, item), Path.Combine(path, item), username, password);
}
MessageBox.Show("success");
}
}
}
评论